#pragma once

#include <AVUIAnimatable.h>

namespace AVUI {
class Renderer;
class Transform3D;
class Rect3D;
class RayHitTestParameters;

class Model3D : public Animatable
{
    friend class Visual3D;
public:
    Model3D() { };

    DECLARE_ELEMENT(Model3D, Animatable);

    DECLARE_DEPENDENCY_PROPERTY(Transform);
    TRefCountedPtr<Transform3D> get_Transform() { return (Transform3D*)(Object*)GetValue(get_TransformProperty()); }
    void set_Transform(Transform3D* pValue) { SetValue(get_TransformProperty(), (Object*)pValue); } 

    Rect3D CalculateSubgraphBoundsOuterSpace();
    virtual Rect3D CalculateSubgraphBoundsInnerSpace() = 0;
 

    void RayHitTest(RayHitTestParameters* pRayParams);
    virtual void RayHitTestCore(RayHitTestParameters* pRayParams) = 0;

    virtual void Render3D(Renderer* pRenderer, const Matrix3D& parentMatrix) = 0;
    virtual void RenderDependencies3D(Renderer* pRenderer) = 0;

    void PreCompute() { }

private:
    static void StaticConstructor();
    bool m_isDirtyForPrecompute;
    bool m_requiresRealizationFlag;
};


}; // namespace AVUI
